import type { CardListResult, ListResult } from '@/api/model/listModel';
import { request } from '@/utils/request';

const Api = {
  BaseList: '/api/admin/sysuser/querySysUser',
  CardList: '/get-card-list',
  FoodList: '/api/admin/food/list',
  MenuList: '/api/admin/sysmenu/querySysMenu',
  MenuListAll: '/api/admin/sysmenu/querySysMenuTreeV3',
  addMenu: '/api/admin/sysmenu/addSysMenu',
};

export function getList(param) {
  return request.get<ListResult>({
    url: Api.BaseList,
    params: param,
  });
}

export function getMenuList(param) {
  return request.get<ListResult>({
    url: Api.MenuList,
    params: param,
  });
}

// 获取所有菜单树状结构
export function MenuListAll() {
  return request.get<ListResult>({
    url: Api.MenuListAll,
  });
}

export function addMenu(param) {
  return request.post<any>({
    url: Api.addMenu,
    params: param,
  });
}

export function getFoodList(param) {
  return request.get<ListResult>({
    url: Api.FoodList,
    params: param,
  });
}

export function getCardList() {
  return request.get<CardListResult>({
    url: Api.CardList,
  });
}
